home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 9948 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.2 KB

  1. Path: isonews.bbn.hp.com!hpbblb!news
  2. From: Matthias Dittrich <matti>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Leap year
  5. Date: 5 Mar 1996 08:15:40 GMT
  6. Organization: Hewlett-Packard Co.
  7. Message-ID: <4hgt7c$48h@hpbblb.bbn.hp.com>
  8. References: <3135A7F2.2120@hiwaay.net> <4hbiln$899@sam.inforamp.net>
  9. NNTP-Posting-Host: trabant.bbn.hp.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 1.1N (X11; I; HP-UX A.09.07 9000/712)
  14. X-URL: news:4hbiln$899@sam.inforamp.net
  15.  
  16. rmorin@inforamp.net (Randy Charles Morin) wrote:
  17. >In article <3135A7F2.2120@hiwaay.net>, Lance Perry <lperry@hiwaay.net> wrote:
  18. >>Can someone be kind enough to post the formula for Leap Year
  19. >>or point me to the place where this can be found?
  20. >>
  21. >>lperry@hiwaay.net
  22. >
  23. >bool IsLeapYear(int x)
  24. >{
  25. >    return ((x&4) && ((!(x&100)) || (x&1000)));
  26. >}
  27. >
  28. >I hope I got everything right.
  29. >
  30. >Agrivar
  31. Sorry, this can't work!
  32. If you are comparing bit patterns, each number containing one of the bits
  33. in the pattern returns a value which is not zero. This means if x=5, the value
  34. of x&4 is 4, which is logical true.
  35. Please test your code before posting !!! This is no help :-(
  36.  
  37. Good luck,
  38. Matthias
  39.  
  40.